'''
TwistedSim script for simple-echo server tutorial.

@author: Hatem Oraby
'''
import twistedSim.simManager as simManager 
from twistedSim.moduleHandler import twistedH

if __name__ == '__main__':

    #Module 1: Echo Server
    serverMachine = simManager.Machine()
    serverInterface = simManager.IpInterface('176.10.0.1', serverMachine)
    serverModule = simManager.Module('simpleserv', twistedH())
    simManager.SimManager.addModule(serverModule, serverMachine)
    
    #Module 2: Client
    clientMachine = simManager.Machine()
    clientInterface = simManager.IpInterface('42.30.125.96', clientMachine)
    clientModule = simManager.Module('simpleclient', twistedH(),
                                    startTime = 100, sysArgs = "176.10.0.1")
    simManager.SimManager.addModule(clientModule, clientMachine)
    
    simManager.SimManager.run()